/**
 * Project: complex.remoting
 * 
 * File Created at 2010-8-19
 * $Id$
 * 
 * Copyright 1999-2100 Alibaba.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package springremoting.rmi;

import java.rmi.Naming;

public class HelloClient {

    /**
     * 查找远程对象并调用远程方法
     */
    public static void main(String[] argv) {
        try {
            HelloInterface hello = (HelloInterface) Naming.lookup("Hello");

            // 如果要从另一台启动了RMI注册服务的机器上查找hello实例
            // HelloInterface hello =
            // (HelloInterface)Naming.lookup("//192.168.1.105:1099/Hello");

            // 调用远程方法
            String word = hello.say();
            System.out.println(word);
        } catch (Exception e) {
            System.out.println("HelloClient exception: " + e);
        }
    }

}
